﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ScrumTable.Common.Collections;
using ScrumTable.DL.Data.Generic.Cache;
using ScrumTable.DL.Data.Generic.Services;

#endregion

namespace ScrumTable.DL.Data.Generic.Test.Mocks
{
    /// <summary>
    /// This is the test class for IDataSaver class.
    /// </summary>
    public class DataSaverStub : IDataSaver
    {
        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------

        private readonly CacheSavePairState _state;

        #endregion

        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        /// Returns true if the async method should be used to synchronize the
        /// data with the back-end system.
        /// </summary>
        public bool UseAsync { get { return false; } }

        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        /// <summary>
        /// Creates a new DataSaverStub instance.
        /// </summary>
        internal DataSaverStub(CacheSavePairState state)
        {
            _state = state;
        }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        /// <summary>
        /// Synchronizes the changes in the business / data layer with the backend-system
        /// in the UI thread.
        /// </summary>
        /// <param name="dataContext">Specifies the data context which contains the underlying data driver root object.</param>
        /// <param name="changes">Specifies the changes to synchronize.</param>
        public void SyncChanges(GenericDataContextBase dataContext, CacheDataChanges changes)
        {
            Assert.IsNotNull(changes);

            changes.MarkChangesAs(_state);
            
        }

        /// <summary>
        /// Loads the data which is required to connect to the back end tfs
        /// system.
        /// </summary>
        /// <param name="dataContext">Specifies the data context which contains the underlying data driver root object.</param>
        /// <param name="changes">Specifies the changes to synchronize.</param>
        public void SyncChangesAsync(AsyncDataContextInfo dataContext, CacheDataChanges changes)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region Events
        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------

        #endregion
    }
}
